<!DOCTYPE html>
<html>
<head>
<head />
<div th:include="base-libs :: base-libs" />
<title>详情</title>
<style type="text/css">
.topBtn{
	float: right;
	margin-right:10px;
	margin-top:5px
}
</style>
</head>
<script th:inline="javascript">
	/**发起机构信息*/
	var fqyljgxx = [[${fqyljgxx}]];
	/**签约申请医联体信息*/
	var qysqxx = [[${qysqxx}]];
	/**签约机构信息*/
	var qyjgxx = [[${qyjgxx}]];
</script>
<script type="text/javascript">
	$(function() {
		initView();
		initData();
	});

	function initData() {
		/**加载发起机构信息*/
		initFqjg();
		/**加载医联体信息*/
		initQysqxx();
		/**加载签约机构信息*/
		initQyjgxx();
	}

	function initView() {
		$("#jgxxTable").datagrid(getOption());
		
		/**历史记录按钮*/
		$("#lsBtn").on("click", function(){
			StoreCache.setCache("QYLB_DETAIL_YLTID", qysqxx["YLTID"]);
			parent.layer.open({
				type: 2,
		  		area: ["80%", "500px"], //宽高
		  		scrollbar: false,
		  		resize: false,
				move: false,
				content: contextRoot + "qylb/" +"lsDetail.html"
			});
		});
		
	}

	/**返回按钮*/
	function btnBackHandler(){
		$.QuickUrlUtils.redirectUrl("index.html");
	}
	
	/**加载发起机构信息*/
	function initFqjg(){
		var jgxx = fqyljgxx[0];
		$(".fqjg").find("span").each(function(){
			$(this).text(jgxx[$(this).attr("id")]);
		});
	}
	
	/**加载医联体信息*/
	function initQysqxx(){
		if(qysqxx){
			var info;
			$(qyjgxx).each(function(index,item){
				if(item["JGLX"]=="3"){
					info = item;
				}
			});
			info = $.extend({}, qysqxx, info);
			$(".yltxx").find(".dataField").each(function(){
				$(this).text(info[$(this).attr("id")]);
			});
			$("#BZSM").text(qysqxx["BZSM"]);
		}
		$("#YLTID").val(qysqxx["YLTID"]);
	}
	
	/**加载签约机构信息*/
	function initQyjgxx(){
		if(qyjgxx){
			if(qysqxx["YLTLX"] == "03"){
				$("#jgxxTable").datagrid(getOption(qysqxx["YLTLX"]));
			}
			$(qyjgxx).each(function(index, item){
				if(item["JGLX"]=="3"){
					qyjgxx.splice(index,1);
					item["QYZTMC"] = "主导机构";
					qyjgxx.splice(0,0,item);
				}
			});
			var length = 37*(qyjgxx.length);
			$("#maxDiv").css("height",length+670+"px");
			$("#maxLayout").layout("resize");
			$("#jgxxBody").css("height", length + 43+"px");
			$("#jgxxTable").datagrid("loadData",{"total": qyjgxx.length, "rows": qyjgxx});
		}
	}
	
	/**获取option*/
	function getOption(lx){
		var opt;
		if(lx == "03"){
			opt= {
					idField : "YLJGDM",
					uniqueId: "PTJGID",
					striped : true,
					border:false,
					clickToSelect: true,
					fit: true,
					fitColumns: true,
					singleSelect: false,
					rownumbers: true,
					columns : [[
						{
							field : "YLJGMC",
							width: 160,
							align: "center",
							title : "机构名称"
						},
						{
							field : "XZQHMC",
							width: 100,
							align: "center",
							title : "所属区域"
						},
						{
							field : "WSJGLBMC",
							width: 120,
							align: "center",
							title : "机构类型"
						},
						{
							field : "KSMC",
							width: 300,
							align: "center",
							title : "科室",
							formatter : function(value, row, index){
								return "<span title='"+value+"'>"+value+"</span>";
							}
						},
						{
							field : "YYDJMC",
							width: 100,
							align: "center",
							title : "医院等级"
						},
						{
							field : "JGFLGLMC",
							width: 120,
							align: "center",
							title : "经营性质"
						},{

							field : "QYZTMC",
							width: 120,
							align: "center",
							title : "签约状态"
						}
					]],onLoadSuccess: function(data){
						$("#jgxxLayout").layout("resize");
					}
				};
		}
		else{
			opt= {
					idField : "YLJGDM",
					uniqueId: "PTJGID",
					striped : true,
					border:false,
					clickToSelect: true,
					fit: true,
					fitColumns: true,
					singleSelect: false,
					rownumbers: true,
					columns : [[
						{
							field : "YLJGMC",
							width: 250,
							align: "center",
							title : "机构名称"
						},
						{
							field : "XZQHMC",
							width: 150,
							align: "center",
							title : "所属区域"
						},
						{
							field : "WSJGLBMC",
							width: 150,
							align: "center",
							title : "机构类型"
						},
						{
							field : "YYDJMC",
							width: 150,
							align: "center",
							title : "医院等级"
						},
						{
							field : "JGFLGLMC",
							width: 150,
							align: "center",
							title : "经营性质"
						},{

							field : "QYZTMC",
							width: 120,
							align: "center",
							title : "签约状态"
						}
					]],onLoadSuccess: function(data){
						$("#jgxxLayout").layout("resize");
					}
				};
		}
		return opt;
	}
</script>

<body style="overflow: scroll">
<div id="maxDiv" style="height: 670px;">
	<div  id="maxLayout" class="easyui-layout">
		<div region="north" style="border: none; overflow: hidden;">
			<h4 class="h4-title" style="font-size: 18px;">
				医联体详情
				<button class="btn topBtn" style="float:right" type="button" id="lsBtn">历史签约详情</button>
			</h4>
			<div class="form-table-box" >
				<form id="managerForm" class="form-horizontal" action="save"></form>
					<h4 class="h4-title" style="font-size: 13px;">
						医联体信息
					</h4>
					<table class="form-table yltxx">
						<tr>
							<td class="td-text">医联体名称：</td>
							<td class="td-content">
								<span id="YLTMC" class="dataField"></span>
								<input style="display:none;" id="YLTID">
							</td>
							<td class="td-text">医联体类型：</td>
							<td class="td-content">
								<span id="YLTLXMC" class="dataField"></span>
							</td>
							<td class="td-text">主导医疗机构：</td>
							<td class="td-content">
								<span id="ZDYLJGMC" class="dataField"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">签约有效期：</td>
							<td class="td-content">
								<span id="QYYXQMC" class="dataField"></span>
							</td>
							<td class="td-text">签约时间：</td>
							<td class="td-content">
								<span id="QYSJ" class="dataField"></span>
							</td>
							<td class="td-text">至</td>
							<td class="td-content">
								<span id="DQSJ" class="dataField">
								</span>
							</td>
						</tr>
					</table>
			</div>
		</div>
		<div region="center" style="border: none;overflow: hidden;">
			<h4 class="h4-title" style="font-size: 13px;">
				机构列表
			</h4>
			<div  id="jgxxBody" style="height:120px;width:96.5%;margin-left:2.5%;">
				<div  id="jgxxLayout" class="easyui-layout" fit="true">
					<div region="center" style="border: none;">
						<table id="jgxxTable" >
									</table>
					</div>
				</div>
			</div>
			<div style="height: 600px;">
				<div class="easyui-layout" fit="true">
					<div region="center" style="border: none; overflow: hidden;">
						<div class="form-table-box" >
							<table class="form-table">
								<tr>
									<td class="td-text">备注说明：</td>
									<td class="td-content" colspan="5">
										<span id="BZSM"></span>
									</td>
								</tr>
							</table>
							<div class="form-table-box" >
								<h4 class="h4-title" style="font-size: 13px;">
									主导机构
								</h4>
								<table class="form-table fqjg">
									<tr>
										<td class="td-text">机构名称：</td>
										<td class="td-content">
											<span id="YLJGMC"></span>
										</td>
										<td class="td-text">机构编码：</td>
										<td class="td-content">
											<span id="YLJGDM"></span>
										</td>
										<td class="td-text">所属区域：</td>
										<td class="td-content">
											<span id="XZQHMC"></span>
										</td>
									</tr>
									
									<tr>
										<td class="td-text">机构类型：</td>
										<td class="td-content">
											<span id="WSJGLBMC"></span>
										</td>
										<td class="td-text">经营性质：</td>
										<td class="td-content">
											<span id="JGFLGLMC"></span>
										</td>
										<td class="td-text">医院等级：</td>
										<td class="td-content">
											<span id="YYDJMC"></span>
										</td>
									</tr>
									
									<tr>
										<td class="td-text">医院地址：</td>
										<td class="td-content yydz" colspan="5">
											<span id="DWDZ"></span>
										</td>
										<!-- <td class="td-text">解约原因：</td>
										<td class="td-content">
											<select id="JYYY" class="form-control" cacheTable="TB_ZY_JYYY"
												quick-config="label:'解约原因', validateProxy:'notNull'">
											</select>
										</td> -->
									</tr>
								</table>
							</div>
							<div class="form-table-box" >
								<h4 class="h4-title" style="font-size: 13px;">
									服务协议信息
								</h4>
								<table class="form-table">
									<tr>
										<td class="td-content">
											<input class="easyui-textbox" readonly="readonly" data-options="multiline:true" style="width:100%;height:100px">
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>


